-
-
Notifications
You must be signed in to change notification settings - Fork 169
fix(imports-as-dependencies): check within exports for types
#1579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🎉 This PR is included in version 61.1.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
| if (!pkg || (!pkg.types && !pkg.typings)) { | ||
| if (!pkg || (!pkg.types && !pkg.typings && !resolve.exports(pkg, '.', { | ||
| conditions: [ | ||
| '!default', '!import', '!node', 'types', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I was following the !default discussions where you posted recently but I'm not up to date with this project so my comment may not apply.
I just wanted to let you know that by excluding with !import, due to the way that resolve.exports (and your fork) works, you may be missing some types conditions defined either inside an imports object (eg, https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#packagejson-exports-imports-and-self-referencing or https://www.typescriptlang.org/docs/handbook/modules/reference.html#example-explicit-types-condition) or as a types object (eg, https://app.unpkg.com/[email protected]/files/package.json#L17).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. Not sure about imports, but for the types object, it seems we would need to add support for hierarchical conditions to resolve.exports.
This rule also misses types defined as globals or based solely on file path.
I think we need separate issues to track these things. Do you care to file one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted a new feature which only checks for types, but also respects nesting. Thanks again for the report!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the types utility to your fork!
fix(
imports-as-dependencies): check withinexportsfor types; fixes #1114